home *** CD-ROM | disk | FTP | other *** search
- Path: qualcomm.com!usenet
- From: nabbasi@qualcomm.com (Nasser Abbasi)
- Newsgroups: comp.lang.c++
- Subject: Re: generic paramter to template question
- Date: 5 Feb 1996 21:53:57 GMT
- Organization: QUALCOMM
- Message-ID: <4f5u9l$3oh@qualcomm.com>
- References: <4eumei$j82@qualcomm.com> <DMBEA7.ID6@news.arco.com>
- NNTP-Posting-Host: nabbasi.qualcomm.com
- Mime-Version: 1.0
- X-Newsreader: WinVN 0.93.14
-
- In article <DMBEA7.ID6@news.arco.com>, lasbfl says...
- >
- >nabbasi@qualcomm.com (Nasser Abbasi) wrote:
- >>hi,
- >>
- >>How can one give a template a parameter that is a value of generic
- type?
- >>
- >>A template can take as paramter as a type, and also it can take a
- >>parameter that is a variable of known type as in:
- >>
- >>template<class T,int item> class foo{..}
- >>
- >>but in the above the type of "item" is not generic. is there a way
- >>to pass "item" above but let the user have its type as generic also (as
- >>with T) ?
- >>
- >>thanks
- >>Nasser
- >>
- >
- >You are allowed any number of parameters of unknown type,ie:
- >template<class T, class U, class V> class food {...}
- >-Brian :-)
- >
-
- I think I did not make my question clear.
-
- In the above, T,U,V are TYPES. the excat TYPE of which is determined
- when the template is instaniated.
-
- What I want is to pass a parameter to a template, and have also the type
- of that parameter be generic.
-
- i.e. if this were allowed, I'd like to do this:
-
- template<class T,<class U>item>
- class foo
- {
- T obj;
- U obj2 = item;
- }
-
-
- thanks
- Nasser
-
-